<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
 Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="ArrayList.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>ArrayList.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		No overview generated for 'ArrayList.js'<BR/><BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="draw2d/ArrayList.html">draw2d.ArrayList</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/* This notice must be untouched at all times.

FreeGroup Draw2D 0.9.26
The latest version is available at
http://www.freegroup.de

Copyright (c) 2006 Andreas Herz. All rights reserved.
Created 5. 11. 2006 by Andreas Herz (Web: http://www.freegroup.de )

LICENSE: LGPL

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,
or see http://www.gnu.org/copyleft/lesser.html
*/</span>

<span class="comment">/**
 * 
 * <span class="attrib">@version</span> 0.9.26
 * <span class="attrib">@author</span> Andreas Herz
 * <span class="attrib">@constructor</span>
 */</span>
draw2d.ArrayList=<span class="reserved">function</span>()
{
   <span class="comment">/* Properties */</span>
   <span class="reserved">this</span>.increment = 10;
   <span class="reserved">this</span>.size = 0;
   <span class="reserved">this</span>.data = new Array(<span class="reserved">this</span>.increment);
};

draw2d.ArrayList.EMPTY_LIST = new draw2d.ArrayList();

draw2d.ArrayList.<span class="reserved">prototype</span>.type=<span class="literal">"draw2d.ArrayList"</span>;


<span class="comment">// reverse the ArrayList</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.reverse=<span class="reserved">function</span>()
{
   var newData = new Array(<span class="reserved">this</span>.size);
   <span class="reserved">for</span> (var i=0; i&lt;<span class="reserved">this</span>.size; i++)
   {
      newData[i] = <span class="reserved">this</span>.data[<span class="reserved">this</span>.size-i-1];
   }
   <span class="reserved">this</span>.data = newData;
};

<span class="comment">// getCapacity() -- returns the number of elements the vector can hold</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.getCapacity=<span class="reserved">function</span>() 
{
   <span class="reserved">return</span> <span class="reserved">this</span>.data.length;
};

<span class="comment">// getSize() -- returns the current size of the vector</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.getSize=<span class="reserved">function</span>() 
{
   <span class="reserved">return</span> <span class="reserved">this</span>.size;
};

<span class="comment">// isEmpty() -- checks to see if the Vector has any elements</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.isEmpty=<span class="reserved">function</span>() 
{
   <span class="reserved">return</span> <span class="reserved">this</span>.getSize() === 0;
};

<span class="comment">// getLastElement() -- returns the last element</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.getLastElement=<span class="reserved">function</span>() 
{
   <span class="reserved">if</span> (<span class="reserved">this</span>.data[<span class="reserved">this</span>.getSize() - 1] !== null) 
   {
      <span class="reserved">return</span> <span class="reserved">this</span>.data[<span class="reserved">this</span>.getSize() - 1];
   }
};

<span class="comment">//</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.asArray=<span class="reserved">function</span>() 
{
  <span class="reserved">this</span>.trimToSize();
  <span class="reserved">return</span> <span class="reserved">this</span>.data;
};

<span class="comment">// getFirstElement() -- returns the first element</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.getFirstElement=<span class="reserved">function</span>() 
{
   <span class="reserved">if</span> (<span class="reserved">this</span>.data[0] !== null &amp;&amp; <span class="reserved">this</span>.data[0] !==undefined) 
   {
      <span class="reserved">return</span> <span class="reserved">this</span>.data[0];
   }
   <span class="reserved">return</span> null;
};

<span class="comment">// getElementAt() -- returns an element at a specified index</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.get=<span class="reserved">function</span>(<span class="comment">/*:int*/</span>i)
{
   <span class="reserved">return</span> <span class="reserved">this</span>.data[i];
};

<span class="comment">// add() -- adds a element at the end of the Vector</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.add=<span class="reserved">function</span>(obj)
{
   <span class="reserved">if</span>(<span class="reserved">this</span>.getSize() == <span class="reserved">this</span>.data.length) 
   {
      <span class="reserved">this</span>.resize();
   }
   <span class="reserved">this</span>.data[<span class="reserved">this</span>.size++] = obj;
};

<span class="comment">// add() -- adds a element at the end of the Vector</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.addAll=<span class="reserved">function</span>(obj)
{
   <span class="reserved">for</span> (var i=0;i&lt;obj.getSize(); i++) 
   {
      <span class="reserved">this</span>.add(obj.get(i));
   }
};

<span class="comment">// indexOf() -- returns the index of a searched element</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.remove=<span class="reserved">function</span>(obj)
{
   var index = <span class="reserved">this</span>.indexOf(obj);
   <span class="reserved">if</span>(index&gt;=0)
    <span class="reserved">return</span> <span class="reserved">this</span>.removeElementAt(index);
   <span class="reserved">return</span> null;
};


<span class="comment">// insertElementAt() -- inserts an element at a given position</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.insertElementAt=<span class="reserved">function</span>(obj, index) 
{
   <span class="reserved">if</span> (<span class="reserved">this</span>.size == <span class="reserved">this</span>.capacity) 
   {
      <span class="reserved">this</span>.resize();
   }
   
   <span class="reserved">for</span> (var i=<span class="reserved">this</span>.getSize(); i &gt; index; i--) 
   {
      <span class="reserved">this</span>.data[i] = <span class="reserved">this</span>.data[i-1];
   }
   <span class="reserved">this</span>.data[index] = obj;
   <span class="reserved">this</span>.size++;
};

<span class="comment">// removeElementAt() -- removes an element at a specific index</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.removeElementAt=<span class="reserved">function</span>(index)
{
   var element = <span class="reserved">this</span>.data[index];

   <span class="reserved">for</span>(var i=index; i&lt;(<span class="reserved">this</span>.getSize()-1); i++)
   {
      <span class="reserved">this</span>.data[i] = <span class="reserved">this</span>.data[i+1];
   }

   <span class="reserved">this</span>.data[<span class="reserved">this</span>.getSize()-1] = null;
   <span class="reserved">this</span>.size--;
   <span class="reserved">return</span> element;
};

<span class="comment">// removeAllElements() -- removes all elements in the Vector</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.removeAllElements=<span class="reserved">function</span>()
{
   <span class="reserved">this</span>.size = 0;

   <span class="reserved">for</span> (var i=0; i&lt;<span class="reserved">this</span>.data.length; i++) 
   {
      <span class="reserved">this</span>.data[i] = null;
   }
};

<span class="comment">// indexOf() -- returns the index of a searched element</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.indexOf=<span class="reserved">function</span>(obj)
{
   <span class="reserved">for</span> (var i=0; i&lt;<span class="reserved">this</span>.getSize(); i++) 
   {
      <span class="reserved">if</span> (<span class="reserved">this</span>.data[i] == obj) 
      {
         <span class="reserved">return</span> i;
      }
   }
   <span class="reserved">return</span> -1;
};

<span class="comment">// contains() -- returns true if the element is in the Vector, otherwise false</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.contains=<span class="reserved">function</span>(obj) 
{
   <span class="reserved">for</span> (var i=0; i&lt;<span class="reserved">this</span>.getSize(); i++) 
   {
      <span class="reserved">if</span> (<span class="reserved">this</span>.data[i] == obj)
      {
         <span class="reserved">return</span> true;
      }
   }
   <span class="reserved">return</span> false;
};

<span class="comment">// resize() -- increases the size of the Vector</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.resize=<span class="reserved">function</span>()
{
   newData = new Array(<span class="reserved">this</span>.data.length + <span class="reserved">this</span>.increment);

   <span class="reserved">for</span>   (var i=0; i&lt; <span class="reserved">this</span>.data.length; i++) 
   {
      newData[i] = <span class="reserved">this</span>.data[i];
   }

   <span class="reserved">this</span>.data = newData;
};


<span class="comment">// trimToSize() -- trims the vector down to it's size</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.trimToSize=<span class="reserved">function</span>()
{
   <span class="comment">// nothing to do</span>
   <span class="reserved">if</span>(<span class="reserved">this</span>.data.length == <span class="reserved">this</span>.size)
      <span class="reserved">return</span>;

   var temp = new Array(<span class="reserved">this</span>.getSize());

   <span class="reserved">for</span> (var i = 0; i &lt; <span class="reserved">this</span>.getSize(); i++) 
   {
      temp[i] = <span class="reserved">this</span>.data[i];
   }
   <span class="reserved">this</span>.size = temp.length;
   <span class="reserved">this</span>.data = temp;
} 

<span class="comment">// sort() - sorts the collection based on a field name - f</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.sort=<span class="reserved">function</span>(f) 
{
   var i, j;
   var currentValue;
   var currentObj;
   var compareObj;
   var compareValue;

   <span class="reserved">for</span>(i=1; i&lt;<span class="reserved">this</span>.getSize();i++) 
   {
      currentObj = <span class="reserved">this</span>.data[i];
      currentValue = currentObj[f];

      j= i-1;
      compareObj = <span class="reserved">this</span>.data[j];
      compareValue = compareObj[f];

      <span class="reserved">while</span>(j &gt;=0 &amp;&amp; compareValue &gt; currentValue) 
      {
         <span class="reserved">this</span>.data[j+1] = <span class="reserved">this</span>.data[j];
         j--;
         <span class="reserved">if</span> (j &gt;=0) {
                  compareObj = <span class="reserved">this</span>.data[j];
                  compareValue = compareObj[f];
         }
      }
      <span class="reserved">this</span>.data[j+1] = currentObj;
   }
};

<span class="comment">// clone() -- copies the contents of a Vector to another Vector returning the new Vector.</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.clone=<span class="reserved">function</span>() 
{
   var newVector = new draw2d.ArrayList(<span class="reserved">this</span>.size);

   <span class="reserved">for</span> (var i=0; i&lt;<span class="reserved">this</span>.size; i++) {
      newVector.add(<span class="reserved">this</span>.data[i]);
   }

   <span class="reserved">return</span> newVector;
};

<span class="comment">// overwriteElementAt() - overwrites the element with an object at the specific index.</span>
draw2d.ArrayList.<span class="reserved">prototype</span>.overwriteElementAt=<span class="reserved">function</span>(obj, index) 
{
   <span class="reserved">this</span>.data[index] = obj;
};

draw2d.ArrayList.<span class="reserved">prototype</span>.getPersistentAttributes=<span class="reserved">function</span>()
{
   <span class="reserved">return</span> {
          data: <span class="reserved">this</span>.data,
          increment: <span class="reserved">this</span>.increment,
          size: <span class="reserved">this</span>.getSize()
          };
};

</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Mon Nov 14 13:45:39 2011</div>
</body>
</html>
